package com.rockcent.mall.lib.domain;

import com.rockcent.common.domain.IDEntityMall;
import com.rockcent.mall.lib.domain.enumclass.AuditStatus;
import com.rockcent.mall.lib.domain.enumclass.MallMemberStatus;
import com.rockcent.mall.lib.domain.enumclass.MerchantStatus;
import com.rockcent.mall.lib.domain.enumclass.UserInfoRegisterType;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by oyhk on 16/7/15.
 */
@Entity
@Table(name = "merchant")
@DynamicInsert
@DynamicUpdate
public class Merchant extends IDEntityMall {
    /**
     * 商家名称
     */
    @Column(columnDefinition = "varchar(255) comment '商家名称'")
    private String name;

    /**
     * 商家邮箱
     */
    @Column(columnDefinition = "varchar(255) comment '商家邮箱'")
    private String email;
    /**
     * 手机号码
     */
    @Column(columnDefinition = "varchar(255) comment '手机号码'")
    private String mobile;
    /**
     * 商城简介
     */
    @Column(columnDefinition = "varchar(255) comment '商城简介'")
    private String intro;
    /**
     * 状态
     */
    @Column(columnDefinition = "varchar(200) comment '状态'")
    @Enumerated(EnumType.STRING)
    private MerchantStatus status = MerchantStatus.UNVERIFY;
    /**
     * 用户id
     */
    @Column(columnDefinition = "bigint comment '用户id'", name = "account_id")
    private Long userInfoId;
    /**
     * 平台id
     */
    @Column(columnDefinition = "bigint comment '平台id'", name = "mall_id")
    private Long mallId;
    /**
     * 分销码
     */
    @Column(columnDefinition = "varchar(200) comment '分销码'")
    private String salesCode;
    /**
     * 注册类型
     */
    @Column(columnDefinition = "varchar(30) comment '注册类型'")
    @Enumerated(EnumType.STRING)
    private UserInfoRegisterType merchantRegisterType;

    /**
     *
     */
    @Column(columnDefinition = "varchar(500) comment '二维码URL'")
    private String promoteUrl;


    /**
     * 是否分销商审核
     */
    @Column(columnDefinition = "bit comment '是否分销商审核'")
    private Boolean prodAudit = false;



    /**
     *
     */
    @Column(columnDefinition = "text comment '商城封面Url'")
    private String faceUrl;

    /**
     *
     */
    @Column(columnDefinition = "text comment '商城LogoUrl'")
    private String logoUrl;

    /**
     *
     */
    @Column(columnDefinition = "bigint comment '商家资金账户ID'")
    private Long merchantFundId;

    /**
     * 试用开始时间
     */
    @Column(columnDefinition = "datetime comment '有效期开始时间'")
    private Date dateEnabled;

    /**
     * 试用结束时间
     */
    @Column(columnDefinition = "datetime comment '有效期结束时间'")
    private Date dateDisabled;

    /**
     * 累计试用天数
     */
    @Column(columnDefinition = "long comment '累计试用天数'")
    private Long probationaryPeriodDays;


    /**
     * 备注
     */
    @Column(columnDefinition = "varchar(30)  comment '备注'")
    private String remark;


    /**
     * 生效时间
     */
    @Column(columnDefinition = "datetime  comment '生效时间，第一次充值完成的时间'")
    private Date effectDate;


    /**
     * 结算日
     */
    @Column(columnDefinition = "varchar(30)  comment '结算日，试用期结束第二天，固定不变'")
    private String settlementDate;


    /**
     * 缓冲期截止日期
     */
    @Column(columnDefinition = "datetime comment '缓冲期截止日期，结算日+加7天的日期'")
    private Date gracePeriodEndDate;


    /**
     * 审核状态
     */
    @Column(columnDefinition = "varchar(30) comment '审核状态 ALL(\"全部\"),WAIT(\"待审核\"),AUDITED(\"已审核\"), PASS(\"通过\"),REFUSE(\"不通过\")'")
    @Enumerated(EnumType.STRING)
    private AuditStatus auditStatus;

    /**
     * 客服联系方式
     */
    @Column(columnDefinition = "varchar(255) comment '客服联系方式'")
    private String customerServiceContact;



    public static final String CLASS_TITLE = "商户";


    public AuditStatus getAuditStatus() {
        return auditStatus;
    }

    public void setAuditStatus(AuditStatus auditStatus) {
        this.auditStatus = auditStatus;
    }

    public String getLogoUrl() {
        return logoUrl;
    }

    public void setLogoUrl(String logoUrl) {
        this.logoUrl = logoUrl;
    }


    public String getFaceUrl() {
        return faceUrl;
    }


    public void setFaceUrl(String faceUrl) {
        this.faceUrl = faceUrl;
    }

    public String getCustomerServiceContact() {
        return customerServiceContact;
    }

    public void setCustomerServiceContact(String customerServiceContact) {
        this.customerServiceContact = customerServiceContact;
    }

    public String getName() {
        return name;
    }

    public String getPromoteUrl() {
        return promoteUrl;
    }

    public void setPromoteUrl(String promoteUrl) {
        this.promoteUrl = promoteUrl;
    }


    public void setName(String name) {
        this.name = name;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    public MerchantStatus getStatus() {
        return status;
    }

    public void setStatus(MerchantStatus status) {
        this.status = status;
    }

    public Long getUserInfoId() {
        return userInfoId;
    }

    public void setUserInfoId(Long userInfoId) {
        this.userInfoId = userInfoId;
    }

    public Long getMallId() {
        return mallId;
    }

    public void setMallId(Long mallId) {
        this.mallId = mallId;
    }

    public String getSalesCode() {
        return salesCode;
    }

    public void setSalesCode(String salesCode) {
        this.salesCode = salesCode;
    }


    public UserInfoRegisterType getMerchantRegisterType() {
        return merchantRegisterType;
    }

    public void setMerchantRegisterType(UserInfoRegisterType merchantRegisterType) {
        this.merchantRegisterType = merchantRegisterType;
    }

    public Boolean getProdAudit() {
        return prodAudit;
    }

    public void setProdAudit(Boolean prodAudit) {
        this.prodAudit = prodAudit;
    }

    public Long getMerchantFundId() {
        return merchantFundId;
    }

    public void setMerchantFundId(Long merchantFundId) {
        this.merchantFundId = merchantFundId;
    }

    public static String getClassTitle() {
        return CLASS_TITLE;
    }

    public Date getDateEnabled() {
        return dateEnabled;
    }

    public void setDateEnabled(Date dateEnabled) {
        this.dateEnabled = dateEnabled;
    }

    public Date getDateDisabled() {
        return dateDisabled;
    }

    public void setDateDisabled(Date dateDisabled) {
        this.dateDisabled = dateDisabled;
    }

    public Long getProbationaryPeriodDays() {
        return probationaryPeriodDays;
    }

    public void setProbationaryPeriodDays(Long probationaryPeriodDays) {
        this.probationaryPeriodDays = probationaryPeriodDays;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getEffectDate() {
        return effectDate;
    }

    public void setEffectDate(Date effectDate) {
        this.effectDate = effectDate;
    }

    public String getSettlementDate() {
        return settlementDate;
    }

    public void setSettlementDate(String settlementDate) {
        this.settlementDate = settlementDate;
    }

    public Date getGracePeriodEndDate() {
        return gracePeriodEndDate;
    }

    public void setGracePeriodEndDate(Date gracePeriodEndDate) {
        this.gracePeriodEndDate = gracePeriodEndDate;
    }

    @Override
    public String toString() {
        return "Merchant{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", dateCreated=" + dateCreated +
                ", email='" + email + '\'' +
                ", lastUpdated=" + lastUpdated +
                ", mobile='" + mobile + '\'' +
                ", intro='" + intro + '\'' +
                ", isDelete=" + isDelete +
                ", version=" + version +
                ", status=" + status +
                ", userInfoId=" + userInfoId +
                ", mallId=" + mallId +
                ", salesCode='" + salesCode + '\'' +
                ", merchantRegisterType=" + merchantRegisterType +
                ", promoteUrl='" + promoteUrl + '\'' +
                ", prodAudit=" + prodAudit +
                ", faceUrl='" + faceUrl + '\'' +
                ", logoUrl='" + logoUrl + '\'' +
                ", merchantFundId=" + merchantFundId +
                ", dateEnabled=" + dateEnabled +
                ", dateDisabled=" + dateDisabled +
                ", probationaryPeriodDays=" + probationaryPeriodDays +
                ", remark='" + remark + '\'' +
                ", effectDate=" + effectDate +
                ", settlementDate='" + settlementDate + '\'' +
                ", gracePeriodEndDate=" + gracePeriodEndDate +
                ", auditStatus=" + auditStatus +
                ", customerServiceContact='" + customerServiceContact + '\'' +
                '}';
    }
}
